﻿using System;
using System.Collections.Generic;
using Gp.Scripts.Core;
using Gp.Scripts.Data;
using Gp.Scripts.Data.Skills;

namespace Gp.Scripts.Equip {
    public abstract class WeaponTypeInfo {
        protected abstract BaseWeaponType Type { get; }

        public WeaponEntity Entity;

        public BaseUnit Unit => Entity.ComEquip.Unit;

        public abstract bool IsBroken { get; set; }
        
        
        protected WeaponTypeInfo(WeaponEntity entity) {
            Entity = entity;
        }

        public abstract int GetDamage();

        public virtual void SmallTurnStart(TurnState state) { }
        public virtual void SmallTurnEnd(TurnState state) { }

        public virtual void AfterAttack(BaseUnit target, AttackActionResult res) { }
        public virtual void AfterDefence(AttackPreReaction attackPreReaction) { }

        public virtual IEnumerable<SkillTags> SkillTag() {
            return Array.Empty<SkillTags>();
        }

        public virtual IEnumerable<WeaponAbilityEntity> WeaponAbilities() {
            return Array.Empty<WeaponAbilityEntity>();
        }

        public virtual bool CanAttack() {
            return true;
        }


        /// <summary>
        /// 行动点消耗
        /// </summary>
        public virtual int ActionCost => 1;

    }


    public abstract class WeaponTypeInfo<T> : WeaponTypeInfo where T : BaseWeaponType {
        protected override BaseWeaponType Type => WeaponType;
        public T WeaponType { get; }

        protected WeaponTypeInfo(T type, WeaponEntity entity) : base(entity) {
            WeaponType = type;
        }
    }
}